Technical Q&A

QTMTB54 - How do I count the frames in an MPEG movie? (30-August-1999)


Q: The movie toolbox function GetMovieNextInterestingTime does not seem to work with MPEG media tracks. The first call to this function just returns a sample time of zero and a duration which is equal to the duration of the movie. Do I have to write special code for MPEG movie tracks?

A: GetMovieNextInterestingTime works for all kinds of tracks. However, you should avoid using the nextTimeMediaSample flag when searching for frames, because some media types store many frames in a single media sample. (For example, MPEG and Flash do this.) If you are searching for distinct frame times, pass the nextTimeStep flag to GetMovieNextInterestingTime.

Be aware, however, that tweening can be used to describe transformations that occur smoothly across a continuum of time rather than at discrete moments. For example, a wipe effect between two video sources will produce a distinct output image at every moment between its start and end times. In such a situation, the question, “How many frames are there?” isn't very helpful, since the honest answer is: “As many as you'd like.”


-- Scott Kuechle
Worldwide Developer Technical Support

Technical Q&As | Contents
Previous Question

To contact us, please use the Contact Us page.